import request from '@/utils/request';
//  财务管理统计页用户统计
export async function userStatistics(params) {
  const res = await request.get(
    '/massage/financialManagement/tgyUserStatistics',
    { params }
  );
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

// 财务管理统计页技师统计

export async function tgyTechnicianStatistics(params) {
  const res = await request.get(
    '/massage/financialManagement/tgyTechnicianStatistics',
    { params }
  );
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

// 财务管理统计页用户订单统计
export async function tgyOrderStatistics(params) {
  const res = await request.get(
    '/massage/financialManagement/tgyOrderStatistics',
    { params }
  );
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

// 获取统计页数据统计用户充值

export async function tgyDataUserStatistics(params) {
  const res = await request.get(
    '/massage/financialManagement/tgyDataUserStatistics',
    { params }
  );
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

export async function yhtjUserOrderStatistics(params) {
  const res = await request.get(
    '/massage/financialManagement/yhtjUserOrderStatistics',
    { params }
  );
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

// 获取用户统计收益明细

export async function yhtjIncomeDetail(params) {
  const res = await request.get(
    '/massage/financialManagement/yhtjIncomeDetail',
    { params }
  );
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

// 获取技师统计

export async function jstjTechnicianstatistics(params) {
  const res = await request.get(
    '/massage/financialManagement/jstjTechnicianstatistics',
    { params }
  );
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

// 获取技师统计技师收益排行榜

//
export async function jstjEarningsLeaderboard(params) {
  const res = await request.get(
    '/massage/financialManagement/jstjEarningsLeaderboard',
    { params }
  );
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

//    获取用户统计用户信息统计图
export async function yhtjUserInfo(params) {
  const res = await request.get('/massage/financialManagement/yhtjUserInfo', {
    params
  });
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

//  获取技师统计技师信息统计图
export async function jstjTechnicianInfo(params) {
  const res = await request.get(
    '/massage/financialManagement/jstjTechnicianInfo',
    {
      params
    }
  );
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

// 余额明细列表
export async function topUpRecordsApi(params) {
  const res = await request.get('/massage/topUpRecords/page', {
    params
  });
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.data.message));
}

export async function topUpRecordsApiDelete(id) {
  const res = await request.delete('/massage/topUpRecords/' + id);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
